home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7566 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: tank.news.pipex.net!pipex!iol!usenet
  2. From: Roy Leonard <rleonard@ferrotec.ie>
  3. Newsgroups: comp.lang.c
  4. Subject: (no subject)
  5. Date: 27 Feb 1996 14:25:39 GMT
  6. Organization: Ferrotec Ltd
  7. Message-ID: <4gv493$p09@nuacht.iol.ie>
  8. NNTP-Posting-Host: ferrotec.iol.ie
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 1.22 (Windows; I; 16bit)
  13.  
  14.  
  15. Hi all,
  16.  
  17. I have a strange problem from an embedded system.  I have an array of 
  18. data, and
  19. I want to count all the high bits (=1) in the array.
  20.  
  21. Hopefully there is a way I can do this in C at high speed.  The 
  22. alternative is assembler, which I would prefer not to do, but I may have 
  23. to.  Does anyone have any nifty ideas about how I might go about this?
  24.  
  25.  
  26. The data is of fixed length (roughly 50 long ints).  Each bit is evenly
  27. weighted.
  28. Eg.
  29.  
  30. If the data in binary was "1001001", the total I'm looking for is three.
  31.  
  32.  
  33.  
  34. Looking forward to some interesting responses!
  35.  
  36. Roy
  37. -- 
  38. -==-
  39. Roy Leonard
  40. leonardr@iol.ie
  41. Development Engineer        
  42.  
  43. "Stress is when your mouth says 'No Problem' and your gut says 'NO WAY'"
  44. -==-
  45.  
  46.  
  47.